<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Yy</title>
</head>

<body>
    <script>
        // 1. 将自己班级的同学添加到一个数组中，每次刷新页面，随机选择一名同学
        var list = ["赵一", "钱二", "孙三", "李四", "周五", "郑六", "王七"];
        var index = Math.floor(Math.random() * list.length);
        console.log(list[index]);
        // 2. 在控制台输出当前时间，每秒输出一次。
        setInterval(function() {
            var d = new Date();
            var hours = d.getHours();
            var minutes = d.getMinutes();
            var seconds = d.getSeconds();
            console.log(hours + ":" + minutes + ":" + seconds);
        }, 1000);
    </script>
</body>

</html>